/*
 * Copyright (c) 2013 Samsung Electronics Co., Ltd.
 * All rights reserved.
 *
 * This software is a confidential and proprietary information of Samsung
 * Electronics, Inc. ("Confidential Information").  You shall not disclose such
 * Confidential Information and shall use it only in accordance with the terms
 * of the license agreement you entered into with Samsung Electronics.
 */

package br.com.poc.pitagorasnumero.model.bo.impl;

import android.content.Context;
import br.com.poc.pitagorasnumero.R;
import br.com.poc.pitagorasnumero.model.bo.IFacebookBO;
import br.com.poc.pitagorasnumero.socialnetwork.FacebookManager;

import com.google.inject.Inject;
import com.google.inject.Singleton;

/**
 * The Class FacebookBO.
 */
@Singleton
public class FacebookBO implements IFacebookBO {

	/** The Facebook Manager class. */
	@Inject
	private FacebookManager facebookManager;

	/** Reference to MainActivity context. */
	private Context context;

	/*
	 * (non-Javadoc)
	 * 
	 * @see br.org.sidi.schef.base.model.bo.IFacebookBO#init()
	 */
	@Override
	public void init(final Context context) {
		this.context = context;
		facebookManager.init(context);
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see br.org.sidi.schef.base.model.bo.IFacebookBO#doAuthentication()
	 */
	@Override
	public void doAuthentication() {
		facebookManager.doAuthentication();
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see
	 * br.org.sidi.schef.base.model.bo.IFacebookBO#share(br.org.sidi.schef.base
	 * .model.entity.Recipe)
	 */
	@Override
	public void share(final String description) {

		facebookManager.uploadPhoto(description, context.getResources()
				.openRawResource(R.drawable.ic_launcher));
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see br.org.sidi.schef.base.model.bo.IFacebookBO#doDisconnect()
	 */
	@Override
	public void doDisconnect() {
		facebookManager.doDisconnect();
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see br.org.sidi.schef.base.model.bo.IFacebookBO#isLoggedIn()
	 */
	@Override
	public boolean isLoggedIn() {
		return facebookManager.isLoggedIn();
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see br.org.sidi.schef.base.model.bo.IFacebookBO#unregisterBroadcast()
	 */
	@Override
	public void unregisterBroadcast() {
		facebookManager.unregisterReceiver();
	}

}
